
<template>
  <div class="statistics">

    <template v-if="roleID == 2">
     
      <el-button plain @click="lastMonth" class="tag" v-if='$route.path === "/agent/settlement/earnings"'>{{'您上月完成案件数：' + getMyInfo.last_mon_total}}</el-button>
      <el-button plain @click="thisMonth" class="tag" v-if='$route.path === "/agent/settlement/earnings"'>{{'您本月完成案件数：' + getMyInfo.mon_total}}</el-button>
      
      <!-- <span class="tag btns" @click="remodification" v-if='$route.path === "/agent/order/myOrder"'>
        <font >您当前返修案件总数：</font>
        <font >{{getMyInfo.back_total}}</font>
      </span> -->
      <template v-if='$route.path === "/agent/order/myOrder" && getType == 1'>
        <el-button plain @click="remodification" class="tag" >{{'您当前返修案件总数：' + getMyInfo.back_total}}</el-button>
        <el-button plain @click="isMyTimeOut" class="tag" >{{'订单超时总数：' + getMyInfo.out_time_orders}}</el-button>
        <el-button plain @click="myOrder" class="tag" v-if='$store.state.user.is_teacher != 2'>{{'自提案件总数：' + getMyInfo.agentOrderCount}}</el-button>
        <el-button plain @click="unPayment" class="tag" v-if='$store.state.user.is_teacher != 2'>{{'待缴费案件总数：' + getMyInfo.unPaymentCount}}</el-button>
      </template>
      
      <template v-if='$route.path === "/agent/order/myOrder" && getType == 2'>
        <el-button plain @click="waitAnswer" class="tag" >{{'等待答复/补正总数：' + getMyInfo.reply_total}}</el-button>
        <el-button plain @click="replyOvertime" class="tag" >{{'答复超时总数：' + getMyInfo.reply_overtime}}</el-button>
      </template>
      <!-- <span class="tag btns" @click="isMyTimeOut" v-if='$route.path === "/agent/order/myOrder"'>
        <font >订单超时总数：</font>
        <font color='#f56c6c'>{{getMyInfo.out_time_orders}}</font>
      </span> -->
      <!-- <span class="tag btns" @click="myOrder" v-if='$route.path === "/agent/order/myOrder" && $store.state.user.is_teacher != 2' >
        <font color="black">自提案件总数：</font>
        <font color='#f56c6c'>{{getMyInfo.agentOrderCount}}</font>
      </span> -->
      <!-- <span class="tag btns" @click="unPayment" v-if='$route.path === "/agent/order/myOrder"' >
        <font color="black">待缴费案件总数：</font>
        <font color='#f56c6c'>{{getMyInfo.unPaymentCount}}</font>
      </span> -->
      <!-- <span class="tag btns" @click="waitAnswer" v-if='$route.path === "/admin/order/answer"'>
        <font color="black">等待答复/补正总数：</font>
				<font color='#f56c6c'>{{getMyInfo.reply_total}}</font>
      </span>
      <span class="tag btns" v-if='$route.path === "/admin/order/answer"' @click="replyOvertime">
        <font color="black">答复超时总数：</font>
				<font color='#f56c6c'>{{getMyInfo.reply_overtime}}</font>
      </span> -->

      <span class="tag" v-if='$route.path === "/admin/order/auditor"'>
        <font color="black">待审核案件总数：</font>
				<font color='#f56c6c'>{{getMyInfo.auditedNum}}</font>
      </span>

      <span class="tag btns" @click='waitAuditorStudent' v-if='$route.path === "/admin/students/list"' >
        <font color="black">待审核出师申请总数：</font>
				<font color='#f56c6c'>{{getMyInfo.graduationCount}}</font>
      </span>

    </template>
    <template v-else>

      <span class="tag btns" @click="waitSubmit" v-if='$route.path === "/admin/order/inProcessing2"'>
        <font color="black">未提交案件数：</font>
				<font color='#f56c6c'>{{getMyInfo.wait_submit_total}}</font>
      </span>
      <span class="tag btns" @click="thisMonthAnnualFee" v-if='$route.path === "/admin/order/inProcessing2"'>
        <font color="black">本月需缴年费案件数：</font>
				<font color='#f56c6c'>{{getMyInfo.annual_fee_count}}</font>
      </span>

      <span class="tag" v-if='$route.path === "/admin/order/pendingDisposal"'>
        <font color="black">待接单案件总数：</font>
				<font color='#f56c6c'>{{getMyInfo.unbind_total}}</font>
      </span>

      <span class="tag btns" v-if='$route.path === "/admin/order/answer"' @click="waitAnswer">
        <font color="black">等待答复/补正总数：</font>
				<font color='#f56c6c'>{{getMyInfo.reply_total}}</font>
      </span>

      <span class="tag btns " v-if='$route.path === "/admin/order/answer"' @click="replyOvertime">
        <font color="black">答复超时总数：</font>
				<font color='#f56c6c'>{{getMyInfo.reply_overtime}}</font>
      </span>

      <span class="tag btns" v-if='$route.path === "/admin/order/inProcessing"' @click="isTimeOut">
        <font color="black">订单超时总数：</font>
				<font color='#f56c6c'>{{getMyInfo.out_time_orders}}</font>
      </span>

      <span class="tag btns" @click="backEditOvertime" v-if='$route.path === "/admin/order/inProcessing"' >
        <font color="black">返修超时总数：</font>
				<font color='#f56c6c'>{{getMyInfo.back_edit_overtime }}</font>
      </span>
      <span class="tag btns" @click="getApplyCA" v-if='$route.path === "/admin/order/inProcessing"' >
        <font color="black">撤案申请总数：</font>
				<font color='#f56c6c'>{{getMyInfo.applyCA }}</font>
      </span>

      <span class="tag btns" v-if='($route.path === "/admin/invoice") && (roleID == 4 || roleID == 1 || roleID == 7)' @click="canInvoice">
        <font color="black">可开票总数：</font>
				<font color='#f56c6c'>{{getMyInfo.can_invoice_total}}</font>
      </span>

      <span class="tag btns" @click="canNuclearMoney" v-if='$route.path === "/admin/invoice/check-fee"'>
        <font color="black">可确认缴款总数：</font>
				<font color='#f56c6c'>{{getMyInfo.can_nuclear_money_total}}</font>
      </span>

      <span class="tag btns" v-if='($route.path === "/admin/invoice/refunds") && (roleID == 4 || roleID == 7)' @click="confirmRefund">
        <font color="black">可确认退款总数：</font>
				<font color='#f56c6c'>{{getMyInfo.can_refund_process_total}}</font>
      </span>
      <span class="tag btns" v-if='($route.path === "/admin/invoice/refunds") && (roleID == 4 || roleID == 1 || roleID == 7)' @click="refundTotal">
        <font color="black">申请退款总数：</font>
				<font color='#f56c6c'>{{getMyInfo.can_refund_total}}</font>
      </span>
      <span class="tag btns" v-if='($route.path === "/admin/invoice/refunds") && (roleID == 4 || roleID == 1 || roleID == 7)' @click="refundedTotal">
        <font color="black">已退款总数：</font>
				<font color='#f56c6c'>{{getMyInfo.refunded_total}}</font>
      </span>

      <span class="tag" v-if='$route.path === "/admin/auditor"'>
        <font color="black">审核超时案件总数：</font>
				<font color='#f56c6c'>{{$store.state.user.verify_total}}</font>
      </span>

      <span class="tag" v-if='$route.path === "/admin/repair"'>
        <font color="black">返修超时案件总数：</font>
				<font color='#f56c6c'>{{getMyInfo.modify_total}}</font>
      </span>
      <span class="tag btns" @click='waitReply' v-if='$route.path === "/admin/repair"' >
        <font color="black">待回复案件总数：</font>
				<font color='#f56c6c'>{{getMyInfo.modify_total_message}}</font>
      </span>

      <span class="tag" v-if='$route.path === "/admin/order/softlist"'>
        <font color="black">软著案件总数：</font>
				<font color='#f56c6c'>{{getMyInfo.soft_total}}</font>
      </span>

      <!-- 管理员提现审核统计 -->
      <span class="tag btns"  @click="waitAgentWithdraw" v-if='$route.path === "/admin/withdraw"'>
        <font color="black">代理人提现待审核数：</font>
				<font color='#f56c6c'>{{getMyInfo.drawing_agent_check }}</font>
      </span>

      <span class="tag btns"  @click="waitUserWithdraw" v-if='$route.path === "/admin/withdraw"'>
        <font color="black">用户提现待审核数量：</font>
				<font color='#f56c6c'>{{getMyInfo.drawing_consumer_check }}</font>
      </span>

      <!-- 管理员活动待审核总数 -->
      <span class="tag btns"  @click="waitReviewActivity" v-if='$route.path === "/admin/reviewActivity"'>
        <font color="black">待审核数量：</font>
				<font color='#f56c6c'>{{getMyInfo.activity_check }}</font>
      </span>

      <!-- 代理人预注册审核 -->
      <span class="tag btns"  @click="waitAgentReview" v-if='$route.path === "/admin/users/agent-review"'>
        <font color="black">待审核代理人总数：</font>
				<font color='#f56c6c'>{{getMyInfo.preregistration }}</font>
      </span>
      <!-- 代理人评分申诉 -->
      <span class="tag btns"  @click="waitGradedReview" v-if='$route.path === "/admin/complaint/appealReview"'>
        <font color="black">待审核申诉总数：</font>
				<font color='#f56c6c'>{{getMyInfo.agent_grades_appeal }}</font>
      </span>
      <!-- 代理人扣款申诉 -->
      <span class="tag btns"  @click="getAppealCount" v-if='$route.path === "/admin/complaint/deductionsAppeal"'>
        <font color="black">待审核申诉总数：</font>
				<font color='#f56c6c'>{{getMyInfo.appealCount }}</font>
      </span>
      <!-- 用户撤回缴费凭证申诉 -->
      <span class="tag btns"  @click="withdrawAppealCount" v-if='$route.path === "/admin/complaint/withdrawImg"'>
        <font color="black">待审核申诉总数：</font>
				<font color='#f56c6c'>{{getMyInfo.revokePayImgCount }}</font>
      </span>

      <!-- 流程上报文件格式待审核总数 -->
      <span class="tag btns" v-if='$route.path === "/admin/order/formatReview"'>
        <font color="black">待审核总数：</font>
				<font color='#f56c6c'>{{getMyInfo.finish_file_format_audit }}</font>
      </span>
      <!-- 反馈意见待审核总是 -->
      <span class="tag btns" @click="waitOpinionCount" v-if='$route.path === "/admin/complaint/opinionAudit"'>
        <font color="black">待审核总数：</font>
				<font color='#f56c6c'>{{getMyInfo.opinion_collect_audit }}</font>
      </span>

    </template>
  </div>
</template>

<script>
import orderFn from "~/pages/admin/order/getOrderList"
import moment from 'moment'
export default {
  data () {
    return {

    }
  },
  computed: {
    getMyInfo ()  {
      return this.myInfo
    }
  },
  methods: {
    // 上月完成案件
    lastMonth () {
      let month = moment().format('M')
      let year = moment().format('Y')
      let monthStartTime = month - 1
      if (month == 1) {
        monthStartTime = 12
        year = year - 1
      }
      let created_at = {}
      created_at.created_start_time = `${year}-${monthStartTime}-1`
      created_at.created_end_time = `${year}-${monthStartTime}-31`
      this.$emit('getData',created_at)
    },
    // 本月完成案件
    thisMonth () {
      let month = moment().format('M')
      let year = moment().format('Y')
      let created_at = {}
      created_at.created_start_time = `${year}-${month}-1`
      created_at.created_end_time = `${year}-${month}-31`
      this.$emit('getData',created_at)
    },
    // 返修总数
    remodification () {
      // this.$router.push( {
      //   path: '/admin/order/myOreder',
      // })
      // if (this.$route.path === '/admin/order/myOreder') {
        let status = '案件修改中'
        this.$emit('getData',status)

      //   this.$store.commit('setFromStatistics', 'isFromMyOreder')
      // } else {
      //   this.$store.commit('setFromStatistics', 'isFromStatistics')
      // }

    },

    // 未提交总数
    waitSubmit () {
      let status = '等待提交国知局'
      this.$emit('getData',status)
    },
    thisMonthAnnualFee () {
      let date = new Date();
      let month = date.getMonth()+1;
      let annual_fee = month
      this.$emit('getData',annual_fee)
    },

    // 等待答复总数
    waitAnswer () {
      let params = {
        status: '等待答复,等待补正',
        page: 1,
      }
      this.$emit('getData',params)
    },

    // 答复超时总数
    replyOvertime () {
      let reply_overtime = 'reply_overtime'
      let params = {
        reply_overtime: 1,
        status: '等待答复,等待补正',
        page: 1,
      }
      this.$emit('getData', params)
    },
    // 国知局超时总数
    isTimeOut () {
      let params = {
        is_time_out: 1
      }
      this.$emit('getData',params)
    },
    isMyTimeOut () {
      let params = 'is_time_out'
      this.$emit('getData',params)
    },
    // 自提案件总数
    myOrder () {
      let status = '自提案件'
      this.$emit('getData',status)
    },
    unPayment() {
      let status = '待缴费案件'
      this.$emit('getData',status)
    },
    // 返修超时总数
    backEditOvertime () {
      let params = {
        back_edit_overtime: 1,
        sort_str: 'back_edit_overtime',
        sort_order: 'desc'
      }
      this.$emit('getData',params)
    },
    // 撤案申请总数
    getApplyCA () {
      let params = {
        applyCA: 1
      }
      this.$emit('getData',params)
    },
    // 流程可确认退款总数
    confirmRefund () {
      let params = {
        refund: '等待退款',
        page: 1
      }
      if(this.roleID == 4 ) {
        params.process_id = this.myInfo.id
      }
      this.$emit('getData',params)
    },
    refundTotal () {
      let params = {
        refund: '等待退款',
      }
      this.$emit('getData',params)
    },
    refundedTotal () {
      let params = {
        refund: '退款成功',
      }
      this.$emit('getData',params)
    },
    // 流程可开票总数
    canInvoice () {
      let params = {
      }
      if(this.roleID == 4 ) {
        params.process_id = this.myInfo.id
      }
      this.$emit('getData',params)
    },
    // 代理人提现待审核总数
    waitAgentWithdraw () {
      let params = {
        user_type: 1,
        status: '0'
      }
      this.$emit('getData',params)
    },
    // 用户提现待审核总数
    waitUserWithdraw () {
      let params = {
        user_type: 2,
        status: '0'
      }
      this.$emit('getData',params)
    },
    // 活动待审核总数
    waitReviewActivity() {
      let params = {
        status: 3
      }
      this.$emit('getData',params)
    },
    // 代理人预注册待审核总数
    waitAgentReview() {
      let params = {
        status: '已上传资料'
      }
      this.$emit('getData',params)
    },
    // 代理人评分申诉待审核总数
    waitGradedReview() {
      let params = {
        status: '0'
      }
      this.$emit('getData',params)
    },
    // 代理人扣款申诉待审核总数
    getAppealCount() {
      let params = {
        status: [3]
      }
      this.$emit('getData',params)
    },
    // 代理人撤回缴费待审核总数
    withdrawAppealCount() {
      let params = {
        status: [3]
      }
      this.$emit('getData',params)
    },
    //
    waitReply () {
      let params = {
        is_reply:  true
      }
      this.$emit('getData',params)
    },
    // 导师待审核徒弟申请出师
    waitAuditorStudent () {
      let params = {
        apply:  'true',
      }
      this.$emit('getData',params)
    },
    // 反馈意见待审核总数
    waitOpinionCount () {
      let params = {
        status: '0',
      }
      this.$emit('getData',params)
    },
    // 确认缴款总数 
    canNuclearMoney () {
      let params = {
        consumer_pay_status : 2,
      }
      this.$emit('getData',params)
    }
  },
  props: ['myInfo', 'roleID', 'getType']
}
</script>

<style lang='less' scoped>
  .statistics {
    display: inline-block;
    // margin-top: 10px;
    /deep/.tag {
      border:1px solid rgba(36,157,255,1);
      border-radius:12px;
      padding: 5px 16px;
      color: #31A3FF;
      font-size: 15px;
      margin: 0 40px 10px 0;

    }
    .tag:hover {
      background:rgba(36,157,255,1);
      color: #fff;
    }
    .tag:focus {
      background:rgba(36,157,255,1);
      color: #fff;
    }

    .a {
      // color: #f56c6c;
      text-decoration: underline;
    }
    .btns {
      cursor: pointer;
    }
  }
</style>
